package com.example.supplychainbackend.entity.project;

import com.example.supplychainbackend.entity.sales.DeliverableEntity;
import com.example.supplychainbackend.entity.sales.SalesInfoEntity;
import com.example.supplychainbackend.tool.DateTimeUtils;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Entity
@Table(name = "project_plan")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ProjectPlanEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    Long id;

    String projectPlanNo;
    String contractNo;
    String contractName;
    String customerName;
    String contractRequiredDeliveryDate;
    String contractSigner;
    String contractSigningUnit;
    String contractSalesArea;
    String contractSigningDate;
    String contractRequirements;
    String contractBusinessDepartment;
    String salesOrderNo;
    String salesOrderName;
    String orderType;
    String orderDeliveryDate;
    String salesPerson;
    String orderDate;
    Integer orderStatus;
    String orderRemarks;
    String orderCreator;
    String orderCreateDate;
    String orderUpdater;
    String orderUpdateDate;
    String deliverables;
    String projectProcessTemplate;
    //创建时间
    String createDate;
    String promisedDeliveryDate;
    Integer status;

    Long projectTemplateId;
    String forecastDeliveryDate;
    String notifiers;

    @OneToMany(cascade = CascadeType.ALL,orphanRemoval = true)
    @JoinColumn(name = "project_plan_id")
    List<PlanDetailEntity> planDetail = new ArrayList<>();

    String	userName;
    String	enterpriseName;
    Boolean	onChain;
    String	transactionId;
    String	commitTime;
    String	userId;
    String	enterpriseId;

    @PrePersist
    protected void onCreate() {
        createDate = DateTimeUtils.getCurrentDateTime();
        status = 0;//创建时 设为待处理状态
    }

}
